home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!hpl3sn03.cern.ch
- From: Dan Pop <danpop@mail.cern.ch>
- Newsgroups: comp.lang.c
- Subject: Re: Limit on #bytes inside of struct?
- Date: Mon, 12 Feb 1996 13:17:47 +0100
- Organization: CERN European Lab for Particle Physics
- Message-ID: <9602121217.AA07160@dxmint.cern.ch>
- References: <4feg1d$d4g@cville-srv.wam.umd.edu> <4ffg6b$ivd@sparcserver.lrz-muenchen.de> <4ffohq$1gb@mordred.gatech.edu> <4ffun7$1l4l@cymbal.aix.calpoly.edu> <311F15D8.78D1@zess.uni-siegen.de>
- X-NNTP-Posting-Host: hpl3sn03.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
- X-Mail2News-Path: dxmint.cern.ch!hpl3sn03.cern.ch
-
- Markus Becker <becker@zess.uni-siegen.de> writes:
-
- >No it isn't, see below.
- >
- >> typedef struct {
- >> int the_array[50000];
- >> } struct_type;
- >>
- >
- >This way, you don't put the 50K numbers in the struct, but only
- >a pointer to them. Should be at most 4 bytes.
-
- Why do clueless people insist on posting their answers and corrections,
- making fools of themselves in front of the whole world is beyond me.
-
- Please take these two mandatory steps before posting your answers and
- objections to other people's answers to c.l.c:
-
- 1. Learn C. A _good_ book will help a lot.
-
- 2. Read the FAQ.
-
- These two steps will help saving our time and your face.
-
- For the technical part of the article:
-
- o I'm typing this on a system where pointers are 8 bytes and I do know
- a system which has 16-byte pointers (and is in current use today).
-
- o Try printing the value of sizeof(struct_type). The most likely
- results are 100000 and 200000 (that is, if you use the correct
- conversion specification in the printf format and if your compiler
- supports objects of this size :-)
-
- o As steps #1 and #2 mentioned above will show you, an array decays into
- a pointer only when used in a value context. And, of course, pointers
- and arrays are _not_ equivalent and cannot be used interchangeably.
-
- >--
- >Markus Becker
- >http://www.zess.uni-siegen.de/private/becker/win95
- ^^^^^
- Could this explain the confusion of the poster? :-)
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-